@extends("layouts.backend.webadmin")
@section('page-header')
    <h1>
        <small></small>
    </h1>
@endsection
@section('content')

<link rel="stylesheet" href="{{env('APP_ROOT')}}/assets/layui/css/layui.css">
<link rel="stylesheet" href="{{env('APP_ROOT')}}/css/vulslist.css">
<script src="{{env('APP_ROOT')}}/assets/layui/layui.js"></script>
<!-- Content Header (Page header) -->

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    {{--<a class="btn btn-primary" href="javascript:;" role="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-search"></i> 搜索</a>--}}
                </div>
                <!-- 搜索开始-->
                <form class="form-inline" action="{{ URL::route('admin.log.index') }}">
                    <div class="box-body">
                        <div class="row">
                            <!-- /.col -->
                            <!-- /.col -->
                            <div class="col-md-12">
                                <div class="form-group date">
                                    <div class="input-group col-sm-10">
                                        <input type="text" class="form-control " id="startTime" placeholder="开始时间" name="startTime" >
                                        <div class="input-group-addon" >
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <input type="text" class="form-control" id="endTime" placeholder="结束时间" name="endTime" >
                                        <div class="input-group-addon" style="margin-left: 25px">
                                            <i class="fa fa-calendar"></i>
                                        </div>
                                        <input type="text" class="form-control" id="searchKeywords" placeholder="用户名" name="searchKeywords">
                                    </div>
                                    {{csrf_field()}}
                                    <button type="submit" class="btn btn-default">搜索</button>
                                </div>


                            </div>
                        </div>
                        <!-- /.row -->
                    </div>
                </form>
                <!-- 搜索结束-->
                <!-- /.box-header -->
                <div class="box-body1">
                    <table id="leveltable" style="table-layout: fixed" class="table table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>用户</th>
                            <th>操作</th>
                            <th>操作ip</th>
                            <th>时间</th>
                            <th>参数</th>
                            <th>链接</th>
                            <th>客户端信息</th>
                            <th>上页访问地址</th>
                            <th>备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        @if(!empty($lists))
                        @foreach ($lists as $key=>$list)
                        <tr>
                            <td >{{$key+1}}</td>
                            <td  style="word-break: break-all">
                                @if(isset($list->name))
                                {{$list->real_name}}（{{$list->name}}）
                                @else($list->user)
                                    {{$list->user->name}}
                                    @endif
                            </td>
                            <td  style="word-break: break-all">{{$list->action}}</td>
                            <td  style="word-break: break-all">{{$list->client_ip}}</td>
                            <td  style="word-break: break-all">{{$list->created_at}}</td>
                            <td  style="word-break: break-all">{{$list->params}}</td>
                            <td  style="word-break: break-all">{{$list->url}}</td>
                            <td  style="word-break: break-all">{{$list->agent}}</td>
                            <td  style="word-break: break-all">{{$list->referer}}</td>
                            <td  >{{$list->remark}}</td>

                        </tr>
                        @endforeach
                            @endif
                        </tbody>
                        <tfoot>
                        </tfoot>
                    </table>
                </div>
            {{ $lists->links("mypage.page") }}
                <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <input type="hidden" id="errors" value="{{session('log_error')}}">
    @if(session('log_error'))
        <script type="text/javascript">
            var message=$("#errors").val();
            layui.use('layer', function(){
                var layer = layui.layer;
                layer.open({
                    title: '错误提示'
                    ,content: message
                });
            });
        </script>

@endif
    <!-- /.row -->
</section>
<!-- /.content -->
@stop

@section('javascript-end')

    <script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#startTime', //指定元素
                type:'datetime'
                ,theme: 'molv'
            });
            laydate.render({
                elem: '#endTime', //指定元素
                type:'datetime'
                ,theme: 'molv'
            });
        });

    </script>
@endsection